//引入mongoose
var mongoose = require("mongoose");
//引入配置
const config=require('../config/environment')
//连接数据库
// mongoose.connect(config.mongodb_url, { useMongoClient: true });
// mongoose.Promise = global.Promise
mongoose.connect(config.mongodb_url);
//监听事件
mongoose.connection.once("open",function(){
	console.log("数据库连接成功~~~");
});
mongoose.connection.once("error",function(){
	console.log("数据库连接出错~~~")
})
mongoose.connection.once("close",function(){
	console.log("数据库连接已经断开~~~");
})

//引入全部model
const user=require('./collection/users')

module.exports={
    user
}


